<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
    <title>美策平台</title>
    <link rel="icon" type="image/png" href="/img/icon.png">
    <link rel="stylesheet" type="text/css" href="../datepicker/jquery-ui.min.css">
    <link rel="stylesheet" type="text/css" href="../css/app.css">
    <link rel="stylesheet" type="text/css" href="../css/index.css">
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="/h5/js/all.js"></script>
</head>
<style>

</style>
<style>
.facHomeMenuActive{
        background-color: #3B7DF2 ! important;
        color: #fff ! important;
    }
.img{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    overflow-y: auto;
    height: 90%;
    width: auto;
    display: flex;
    flex-direction: column;
}
.img img{
    width: auto;
    margin: .133333rem 0;
}
.blank{
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    opacity: 0.6;
    z-index: 1999;
    display: none;
}
.departTable{
    display: none;
}
.requireDepartsTable {
    display: none;
}
.requireProTable{
    display: none;
}
.standardsTable{
    display: none;
}
.nullCetner {
text-align: center;
position: absolute;
top: 6.666667rem;
transform: translate(-50%, -50%);
left: 50%;
color: #c3c3c3;
}
</style>
<body>
<!--
    制作者：九哥
    页面：工厂详情页面
    时间：2019-03-01
-->





<!----------工厂主页面---------->
<div id="facHomePage"><!--此ID页面切换用-->
    <div id="facHomeTitle">
        <b>工厂主页</b>
        <img src="../images/return.png" id="facHomeRtn">
    </div>
    <div id="facHomePpt" >

    </div>
    <div id="facHomeDetail">
        <div style="height:10px;"></div>
        <div class="menu">
            <p>主页</p>
            <!-- <div data-id="1" class="facHomeMenu facHomeMenuActive">产品</div>
            <div data-id="2" class="facHomeMenu">关于工厂</div> -->
            <div data-id="3" class="facHomeMenu facHomeMenuActive">法人信息</div>
            <div data-id="4" class="facHomeMenu">工厂信息</div>
            <div data-id="5" class="facHomeMenu">工厂认证</div>
            <div data-id="6" class="facHomeMenu">生产设备</div>
            <div data-id="7" class="facHomeMenu">产量产能</div>
            <div data-id="8" class="facHomeMenu">工厂环境</div>
        </div>
        <!--产品-->
        <div class="facHomeList facHomeList1" style="display: none">
            <div class="company tofacProShow">
                <img src="/uploads/20190227/gsfz.png">
                <p>策美服装</p>
            </div>
            <div class="company tofacProShow">
                <img src="/uploads/20190227/gsfz.png">
                <p>策美服装</p>
            </div>
            <div class="company tofacProShow">
                <img src="/uploads/20190227/gsfz.png">
                <p>策美服装</p>
            </div>
            <div class="company tofacProShow">
                    <img src="/uploads/20190227/gsfz.png">
                    <p>策美服装</p>
                </div>
                <div class="company tofacProShow">
                        <img src="/uploads/20190227/gsfz.png">
                        <p>策美服装</p>
                    </div>
        </div>
        <!--关于我们-->
        <div class="facHomeList facHomeList2" style="display: none">
            <b>关于我们</b>
            <p>熟悉各类网页设计软件；有品牌设计经验；有天猫、京东、唯品会等平台设计经验；3年以上工作经验；本科以上学历。</p>
            <hr>
            <br>
            <b>我们的宗旨</b>
            <p>熟悉各类网页设计软件；有品牌设计经验；有天猫、京东、唯品会等平台设计经验；3年以上工作经验；本科以上学历。</p>
            <hr>
            <br>
            <b>我们的团队</b>
            <p>熟悉各类网页设计软件；有品牌设计经验；有天猫、京东、唯品会等平台设计经验；3年以上工作经验；本科以上学历。</p>
            <hr>
            <br>
            <b>我们的坐标</b>
            <p>杭州市西湖区文三路东部软件园8幢511</p>
            <!-- <iframe src="https://ditu.amap.com/" frameborder="0"></iframe> -->
        </div>
        <!--法人信息-->
        <div class="facHomeList facHomeList3" style="display: block">
            <b style="font-size: 14px;">法人信息</b>
            <table>
                <tr>
                    <td>姓名：</td>
                    <td id="legal_name">陈先生</td>
                </tr>
                <tr>
                    <td>性别：</td>
                    <td id="legal_sex">男</td>
                </tr>
                <tr>
                    <td>常用手机：</td>
                    <td id="legal_mobile">15090784532</td>
                </tr>
                <tr>
                    <td>身份证正面：</td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <img id="legal_id_photo0" src="/uploads/20190227/idcard_zm.png">
                    </td>
                </tr>
                <tr>
                    <td>身份证侧面：</td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <img id="legal_id_photo1" src="/uploads/20190227/idcard_cm.png">
                    </td>
                </tr>
                <tr>
                    <td>身份证手持正面：</td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <img id="legal_id_photo2" src="/uploads/20190227/idcard_sczm.png">
                    </td>
                </tr>
            </table>
        </div>
        <!--工厂信息-->
        <div class="facHomeList facHomeList4">
            <b>工厂信息</b>
            <table>
                <tr>
                    <td width="70">工厂名称：</td>
                    <td id="com_name">杭州策美网络科技有限公司</td>
                </tr>
                <tr>
                    <td>工厂座机：</td>
                    <td id="com_tel">0571-80808080</td>
                </tr>
                <tr>
                    <td>工厂传真：</td>
                    <td id="com_fax">0571-80808080</td>
                </tr>
                <tr>
                    <td>工厂地址：</td>
                    <td id="com_address">杭州市西湖区文三路东部软件园8幢901</td>
                </tr>
                <tr>
                    <td>工厂满意度：</td>
                    <td id="cus_like"></td>
                </tr>
                <tr>
                    <td>合同履行率：</td>
                    <td id="pact">99%</td>
                </tr>
                <tr>
                    <td>品质满意度：</td>
                    <td id="quality">99%</td>
                </tr>
            </table>
        </div>
        <!--工厂证书-->
        <div class="facHomeList facHomeList5">
            <b>法人认证</b>
            <hr>
            <div class="legal_licences">
                <p>法人照片
                    <button class="image" id="photos">点击查看</button>
                </p>
                <p>身份证照片
                    <button class="image" id="idcards">点击查看</button>
                </p>
                <p>毕业证照片
                    <button class="image" id="graduates">点击查看</button>
                </p>
                <p>证书
                    <button class="image" id="honors">点击查看</button>
                </p>
                <p>结婚证
                    <button class="image" id="marrys">点击查看</button>
                </p>
                <p>驾驶证
                    <button class="image" id="drives">点击查看</button>
                </p>
            </div>
            <hr>
            <br>
            <b>公司认证</b>
            <hr>
            <div class="com_licences">
                <p>组织机构代码证
                    <button class="image" id="zzjgdm">点击查看</button>
                </p>
                <p>营业执照
                    <button class="image" id="yyzz">点击查看</button>
                </p>
                <p>税务登记证
                    <button class="image" id="swdj">点击查看</button>
                </p>
                <p>租赁合同
                    <button class="image" id="rent">点击查看</button>
                </p>
                <p>各类许可证
                    <button class="image" id="licence">点击查看</button>
                </p>
                <p>荣誉证书
                    <button class="image" id="honor">点击查看</button>
                </p>
                <p>房产证
                    <button class="image" id="house">点击查看</button>
                </p>
            </div>
        </div>
        <!--生产设备-->
        <div class="facHomeList facHomeList6">
            <!--<b>生产设备</b>-->
            <!--<hr>-->
            <!--<p>普通模板机-->
            <!--<button>点击查看</button>-->
            <!--</p>-->
            <!--<p>自动模板机-->
            <!--<button>点击查看</button>-->
            <!--</p>-->
            <!--<p>电脑平车-->
            <!--<button>点击查看</button>-->
            <!--</p>-->
            <!--<p>三线拷边机-->
            <!--<button>点击查看</button>-->
            <!--</p>-->
            <!--<p>四线拷边机-->
            <!--<button>点击查看</button>-->
            <!--</p>-->
            <!--<p>五线拷边机-->
            <!--<button>点击查看</button>-->
            <!--</p>-->
            <div class="equip">
                <img src="/uploads/20190227/gcequiptest.png">
                <p>普通模板机</p>
            </div>
            <div class="equip">
                <img src="/uploads/20190227/gcequiptest.png">
                <p>自动模板机</p>
            </div>
            <div class="equip">
                <img src="/uploads/20190227/gcequiptest.png">
                <p>电脑平车</p>
            </div>
        </div>
        <!--产能产量-->
        <div class="facHomeList facHomeList7">
            <b class="departTable">产量产能</b>
            <hr class="departTable">
            <table class="departTable">
                <tr id="depart">
                    <th>核心部门</th>
                    <th>人数/产量</th>
                </tr>
                <tr>
                    <td>日产量（件）</td>
                    <td id="dayOutPut">123 - 456</td>
                </tr>
                </div>
            </table>
            <br>
            <b class="requireDepartsTable">质检部门</b>
            <hr class="requireDepartsTable">
            <table class="requireDepartsTable">
                <tr id="requireDeparts">
                    <th>部门</th>
                    <th>人数（人）</th>
                </tr>
                <tr>
                    <td>组检</td>
                    <td>45</td>
                </tr>
                <tr>
                    <td>尾查</td>
                    <td>45</td>
                </tr>
                <tr>
                    <td>巡检</td>
                    <td>45</td>
                </tr>
            </table>
            <br>
            <b class="requireProTable">质检流程</b>
            <hr class="requireProTable">
            <table class="requireProTable">
                <tr id="requirePro">
                    <th>产品类型</th>
                    <th>几道检验</th>
                </tr>
            </table>
            <hr class="standardsTable">
            <b class="standardsTable">质检标准</b>
            <table class="standardsTable" id="standards"></table>
        </div>
        <!--公司环境-->
        <div class="facHomeList facHomeList8">
            <b>公司环境</b>
            <hr>
            <div class="envs">
                <p>总经理
                    <button class="image" id="managers">点击查看</button>
                </p>
                <p>厂长
                    <button class="image" id="facManagers">点击查看</button>
                </p>
                <p>财务室
                    <button class="image" id="finances">点击查看</button>
                </p>
                <p>门卫
                    <button class="image" id="guards">点击查看</button>
                </p>
                <p>厂房外形图
                    <button class="image" id="shapes">点击查看</button>
                </p>
                <p>充绒房
                    <button class="image" id="raws">点击查看</button>
                </p>
                <p>技术部
                    <button class="image" id="techs">点击查看</button>
                </p>
                <p>缝制车间
                    <button class="image" id="works">点击查看</button>
                </p>
                <p>后道车间
                    <button class="image" id="backs">点击查看</button>
                </p>
                <p>裁剪车间
                    <button class="image" id="cuts">点击查看</button>
                </p>
                <p>工厂宿舍
                    <button class="image" id="dorms">点击查看</button>
                </p>
                <p>样衣间
                    <button class="image" id="samples">点击查看</button>
                </p>
            </div>
        </div>
    </div>
</div>
<!----------工厂主页面---------->




<div class="img"></div>
<div class="blank"></div>

<!----------错误提示---------->
<div id="errMsg"></div>
<!----------错误提示---------->
</body>
<script type="text/javascript" src="../js/indexPageChange.js"></script>
<script type="text/javascript" src="../js/index.js"></script>
<script type="text/javascript" src="../js/alertMsg.js"></script>
<script>
    $(function(){
        var id =MC.get('id'); ////JSON.parse(getQueryString('ids')).id;
        var userInfo = JSON.parse(localStorage.getItem('userInfo'));
        var token = userInfo.token;
        var type = userInfo.type;
        var legal_licences = {}
        var com_licences = {}
        var envs = {}
        $.ajax({
            url: '/api/home/customer/detail',
            data: {
                id: id,
                token: token,
                type: type
            },
            dataType: 'json',
            type: 'get',
            async:false, 
            success: function(data) {
               if (data.code === 200) {
                   var list = data.data;
                   $('#legal_name ').html(list.legal_name);
                   $('#legal_sex').html(`${list.legal_sex === 1 ? '男' : list.legal_name === 2 ? '女' : ''}`);
                   $('#legal_mobile').html(list.legal_mobile);
                   $('#legal_id_photo0').attr('src', list.legal_id_photo[0]);
                   $('#legal_id_photo1').attr('src', list.legal_id_photo[1]);
                   $('#legal_id_photo2').attr('src', list.legal_id_photo[2]);
                   $('#com_name').html(list.com_name);
                   $('#com_tel').html(list.com_tel);
                   $('#com_fax').html(list.com_fax);
                   $('#com_address').html(list.com_address);
                   $('#cus_like').html(list.cus_like);
                   $('#quality').html(list.quality);
                   $('#pact').html(list.pact);
                   legal_licences = list.legal_licences;
                   com_licences = list.com_licences;
                   envs = list.envs;
                   var yields = list.yields;
                   if (Object.keys(yields).length === 0) {
                       $('.comHomeList8').html('<div class="nullCetner">暂无</div>')
                   }
                   if (yields.departs) {
                       $('.departTable').show();
                        var depart = '';
                        var departs = '';
                        depart = yields.departs.map(function(item, index) {
                            departs += `  <tr>
                                            <td>${item.key}</td>
                                            <td>${item.num}</td>
                                            </tr>
                                            `
                                return departs; 
                        })
                        $('#depart').next(depart);
                    }
                    if (yields.dayOutPuts) {
                        $('#dayOutPut').html(`${yields.dayOutPuts[0]}-${yields.dayOutPuts[1]}`);
                    }
                    if (yields.requirePros) {
                        $('.requireProTable').show();
                        var requirePro = '';
                        var requirePros = '';
                        requirePro = yields.requirePros.map(function(item, index) {
                            requirePros += `<tr>
                                            <td>${item.key}</td>
                                            <td>${item.val}道</td>
                                        </tr>`
                            return requirePros;
                        })
                        $('#requirePro').next(requirePro);
                    }
                   
                    if (yields.requireDeparts) {
                        $('.requireDepartsTable').show();
                        var requireDepart = '';
                        var requireDeparts = '';

                        requireDepart = yields.requireDeparts.map(function(item, index) {
                            requireDeparts += `<tr>
                                                <td>${item.key}</td>
                                                <td>${item.num}</td>
                                            </tr>`
                                return requireDeparts;
                        })
                        $('#requireDeparts').next(requireDepart);
                    }
                    if (yields.standards) {
                        $('.standardsTable').show();
                        var standards = yields.standards;
                        var standardsItem = '';
                        standards.map(function(item, index) {
                            if (index === 0) {
                                if (item === 1) {
                                    standardsItem += `<tr>
                                                            <td>《工艺单》、样品</td>
                                                        </tr>`
                                }
                            }
                            if (index === 1) {
                                if (item === 1) {
                                    standardsItem += `<tr>
                                                            <td>摊平用尺量用目视用手摸</td>
                                                        </tr>`
                                }
                            }
                            if (index === 2) {
                                if (item === 1) {
                                    standardsItem += `<tr>
                                                            <td>质检：每件产品全检</td>
                                                        </tr>`
                                }
                            }
                            if (index === 3) {
                                if (item === 1) {
                                    standardsItem += `<tr>
                                                            <td>总检：抽查品质、尺寸</td>
                                                        </tr>`
                                }
                            }
                            if (index === 4) {
                                if (item === 1) {
                                    standardsItem += `<tr>
                                                            <td>巡检：对在线生产产品巡查</td>
                                                        </tr>`
                                }
                            }
                        })
                        $('#standards').html(standardsItem);
                    }
                   
               }
            }
        })
        
        function clickImg(items, legal_licences) {
            $(`${items} .image`).click(function() {
                console.log(legal_licences);
                var type = $(this).attr('id');
                var html = '';
                try {
                    var arr = Object.keys(legal_licences);
                    if (arr.length === 0) {
                        alertMsg('暂无图片');
                    } else {
                        Object.keys(legal_licences).forEach(function(key) {
                            if (key === type) {
                                var item = legal_licences[key];
                                if (item.length === 0) {
                                    throw new Error('暂无照片')
                                } else {
                                    item.forEach(function(item, index) {
                                        html += `<img src='${item}'>`;
                                    })
                                }
                                $('.img').html(html).show();
                                $('.blank').show();
                            }   
                        });
                       
                    }
                   
                } catch (e) {
                    alertMsg(e)
                } 
            })
        }
        clickImg('.legal_licences', legal_licences);
        clickImg('.com_licences', com_licences);
        clickImg('.envs', envs);
        $('.blank').click(function() {
            $(this).hide();
            $('.img').html('').hide();
        })
    })
   
</script>
</html>